<?php

session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册</title>
<link href="style/css.css" rel="stylesheet" type="text/css">
<script src="js/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="js/jquery.blockUI.js" type="text/javascript"></script>

<script type="text/javascript"> 
var sendPhone="";
function sendSMS() //点击提交留言ajax显示
{ 
  
  var zhanghao=$("#userzhanghao").val();

  $.ajax({ 
    type:'post', //传送的方式,get/post 
    url:'getUsername.php', //发送数据的地址 
    cache:'false', 
    data:'zhanghao='+zhanghao, 
    datatype:"text",
    success:function(data) 
    { 
      var hi=data.split(",");
      if(hi[0]=="success"){
        sendPhone=hi[1];
        $.ajax({ 
               type:'post', //传送的方式,get/post 
               url:'post_mt.php', //发送数据的地址 
               cache:'false', 
               data:'name='+hi[1], 
              success:function(data) 
                { 
              
                }
            })

      }else{

        alert("该账号不存在");
      }

    }
  });


  
/*   */

  time(document.getElementById("reSend"));
} 

function forgetPass(){
   //给box_btn绑定一个鼠标点击的事件
  $.blockUI({    //当点击事件发生时调用弹出层
    message: $('#loginbox3'),    //要弹出的元素box
    css: {    //弹出元素的CSS属性
      border:'5px solid #334343',
      textAlign: 'left',
    width: '490px',
    top:  ($(window).height() - 290) /2 + 'px', 
      left: ($(window).width() - 490) /2 + 'px', 
    cursor: 'auto'
         },
    overlayCSS: {
    opacity: '0.7' 
              }
   });
  $('.blockOverlay').attr('title','单击关闭').click($.unblockUI);   //遮罩层属性的设置以及当鼠标单击遮罩层可以关闭弹出层
  $('.close').click($.unblockUI);  //也可以自定义一个关闭按钮来关闭弹出层
 

  




}
function phoneCheck(){

var yanzhengma=$("#yanzhengma").val();
//
if(yanzhengma==""){
    alert("请输入验证码!");
  }else{

    $.ajax({ 
    type:'post', //传送的方式,get/post 
    url:'phonecheckAjax.php', //发送数据的地址 
    cache:'true',  
    data:'phonecheck='+yanzhengma,
    datatype:"text",
    success:function(data) 
    { 
      
     if(data=="yes"){
      
       $.ajax({ 
    type:'post', //传送的方式,get/post 
    url:'sendupdatePass.php', //发送数据的地址 
    cache:'true',  
    data:'phonecheck=2',
    datatype:"text",
    success:function(data) 
    { 
      var hi=data.split(",");
      if(hi[0]=="yes"){

    $.ajax({ 
               type:'post', //传送的方式,get/post 
               url:'post_mt1.php', //发送数据的地址 
               cache:'false', 
               data:'name='+sendPhone+"&sendValue="+"您的重置密码为:"+hi[1],  
              success:function(data) 
                { 
      
                }
            });
        alert("成功重置，密码会以短信形式发送给您");
      }else if(hi[1]=="no"){
        alert("重置密码失败");
      }

    } 
  }); 





     
     }else if(data=="no"){
     alert("验证码错误");

     }else{
      alert("验证码错误");
     }
    } 
  }); 

  }
}

//

function userphonecheck(){
var userphone=$("#regphone").val();
if(userphone.length>0){
$("#mima").html("最少6个字符");
 $("#mima").css("color"," #999999");
}else{
  $("#mima").html("密码不允许为空");
 $("#mima").css("color","red");
}

}   
function usernamecheck(){
  var username=$("#reguser").val();
  if(username.length>0){
    $("#zhanghao").html("3-15个字符，一个汉字为两个字符");
        $("#zhanghao").css("color"," #999999");
  }else{
     $("#zhanghao").html("用户名不能为空");
        $("#zhanghao").css("color","red");
  return;
  }
  $.ajax({ 
      type:'post', //传送的方式,get/post 
      url:'regCheckAjax.php', //发送数据的地址 
      cache:'false', 
      data:'username='+username+"&which=0",
      datatype:"text",
      success:function(data) 
      { 
        if(data=="no"){
          
        $("#zhanghao").html("该账号已经存在");
        $("#zhanghao").css("color","red");
        }else if(data=="yes"){
      $("#zhanghao").html("该账号可用");
        $("#zhanghao").css("color"," #999999");
        }
      } 
  });
}
function mobilecheck(){
  var mobile=$("#mobile").val();
  var me= /^1[3|4|5|8][0-9]\d{4,8}$/  ;
  if (!me.test(mobile))
  {
   $("#shoujihaoma").html("请正确输入手机号码!");
   $("#shoujihaoma").css("color","red");
    return (false);
  }
  $.ajax({ 
      type:'post', //传送的方式,get/post 
      url:'regCheckAjax.php', //发送数据的地址 
      cache:'false', 
      data:'mobileno='+mobile+"&which=2",
      datatype:"text",
      success:function(data) 
      { 
        if(data=="no"){
          $("#shoujihaoma").html("该手机号已经存在");
          $("#shoujihaoma").css("color","red");
          $("#reSend").attr("disabled","true");
        }else if(data=="yes"){
          $("#shoujihaoma").html("该手机号可用");
          $("#shoujihaoma").css("color"," #999999");
          $("#reSend").removeAttr("disabled");
        }
      } 
  });
}
$(function(){ 
//Default Action 
$(".tab_content").hide(); //Hide all content 
$("ul.tabs li:first").addClass("active").show(); //Activate first tab 
$(".tab_content:first").show(); //Show first tab content 
//On Click Event 
$("ul.tabs li").click(function() { 
$("ul.tabs li").removeClass("active"); //Remove any "active" class 
$(this).addClass("active"); //Add "active" class to selected tab 
$(".tab_content").hide(); //Hide all tab content 
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content 
$(activeTab).fadeIn(); //Fade in the active content 
return false; 
}); 
}); 
</script> 
<script type="text/javascript"> 
var wait=60;

function time(o) {
        if (wait == 0) {
            o.removeAttribute("disabled");           
            o.value="重新发送验证码";
            wait = 60;
            o.className="resend-a";
        } else {
         o.className="resend-a2";
            o.setAttribute("disabled", true);
            o.value="重新发送(" + wait + ")";
            wait--;
            setTimeout(function() {
                time(o)
            },
            1000)
        }
    }


$(function(){
  $('#login').click(function(){   //给box_btn绑定一个鼠标点击的事件
  $.blockUI({    //当点击事件发生时调用弹出层
    message: $('#loginbox'),    //要弹出的元素box
    css: {    //弹出元素的CSS属性
      border:'5px solid #334343',
      textAlign: 'left',
    width: '490px',
    top:  ($(window).height() - 290) /2 + 'px', 
      left: ($(window).width() - 490) /2 + 'px', 
    cursor: 'auto'
         },
    overlayCSS: {
    opacity: '0.7' 
              }
   });
  $('.blockOverlay').attr('title','单击关闭').click($.unblockUI);   //遮罩层属性的设置以及当鼠标单击遮罩层可以关闭弹出层
  $('.close').click($.unblockUI);  //也可以自定义一个关闭按钮来关闭弹出层
  $("#alllogin").attr("action","login.php");

  });
 
   $('#nowlogin').click(function(){   //给box_btn绑定一个鼠标点击的事件
  $.blockUI({    //当点击事件发生时调用弹出层
    message: $('#loginbox'),    //要弹出的元素box
    css: {    //弹出元素的CSS属性
      border:'5px solid #334343',
      textAlign: 'left',
    width: '490px',
    top:  ($(window).height() - 290) /2 + 'px', 
      left: ($(window).width() - 490) /2 + 'px', 
    cursor: 'auto'
         },
    overlayCSS: {
    opacity: '0.7' 
              }
   });
  $('.blockOverlay').attr('title','单击关闭').click($.unblockUI);   //遮罩层属性的设置以及当鼠标单击遮罩层可以关闭弹出层
  $('.close').click($.unblockUI);  //也可以自定义一个关闭按钮来关闭弹出层
  $("#alllogin").attr("action","login.php");

  });
  
$('#shoplogin').click(function(){   //给box_btn绑定一个鼠标点击的事件
  $.blockUI({    //当点击事件发生时调用弹出层
    message: $('#loginbox1'),    //要弹出的元素box
    css: {    //弹出元素的CSS属性
      border:'5px solid #334343',
      textAlign: 'left',
    width: '490px',
    top:  ($(window).height() - 290) /2 + 'px', 
      left: ($(window).width() - 490) /2 + 'px', 
    cursor: 'auto'
         },
    overlayCSS: {
    opacity: '0.7' 
              }
   });
  $('.blockOverlay').attr('title','单击关闭').click($.unblockUI);   //遮罩层属性的设置以及当鼠标单击遮罩层可以关闭弹出层
  $('.close').click($.unblockUI);  //也可以自定义一个关闭按钮来关闭弹出层
  $("#alllogin").attr("action","login-shop.php");
  });


  
  
});

function InputCheck(LoginForm)
{

  var thisc=true;
  if (LoginForm.username.value == "")
  {
    alert("请输入用户名!");
    LoginForm.username.focus();
    return (false);
  }
  if (LoginForm.password.value == "")
  {
    alert("请输入密码!");
    LoginForm.password.focus();
    return (false);
  }
}

function RegCheck(RegForm)
{
  
  if(document.getElementById("store2").checked){
  

  }else{

    alert("请同意使用条款和协议!");
    
    return (false);

  }
  if (RegForm.username.value == "")
  {
   $("#zhanghao").html("用户名不能为空");
    $("#zhanghao").css("color","red");
    RegForm.username.focus();
    return (false);
  }

var re=/^([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9])*$/;
  if(!re.test(RegForm.username.value) ){
    $("#zhanghao").html("错误：用户名不符合规定。3-15个字符，一个汉字为两个字符");
    $("#zhanghao").css("color","red");
    RegForm.username.focus();
    return (false);
  }
  
  if (RegForm.password1.value == "")
  {
    $("#mima").html("请输入密码");
     $("#mima").css("color","red");
    RegForm.password1.focus();
    return (false);
  }
  if(RegForm.password1.value.length < 6){
    $("#mima").html("错误：密码长度不符合规定。最少6个字符");
     $("#mima").css("color","red");
    RegForm.password1.focus();
    return (false);
  }
 

  if (RegForm.password2.value == "")
  {
    $("#mima2").html("请输入密码");
     $("#mima2").css("color","red");
    RegForm.password2.focus();
    return (false);
  }
  if (RegForm.password2.value != RegForm.password1.value)
  {
     $("#mima2").html("请确认输入密码一致!");
    $("#mima2").css("color","red");
    RegForm.password1.focus();
    RegForm.password2.focus();
    return (false); 
  }else{
    $("#mima2").html("与上方填写相同!");
$("#mima2").css("color","#999999");

  }
  var me= /^1[3|4|5|8][0-9]\d{4,8}$/	;
  if (!me.test(RegForm.mobile.value))
  {
    $("#shoujihaoma").html("请确认手机号码!");
     $("#shoujihaoma").css("color","red");
    RegForm.mobile.focus();
    return (false);
  }else
  $("#shoujihaoma").html("用于接收验证码及订单信息!");
  $("#shoujihaoma").css("color","#999999");
   if(RegForm.phonecheck.value==""){

    $("#yanzhengma").html("请输入验证码!");
    $("#yanzhengma").css("color","red");
    RegForm.password1.focus();
    return (false);

  }else{
     $("#yanzhengma").html("填写手机接收到的验证码!");
    $("#yanzhengma").css("color","#999999");

    $.ajax({ 
    type:'post', //传送的方式,get/post 
    url:'phonecheckAjax.php', //发送数据的地址 
    cache:'true',  
    data:'phonecheck='+RegForm.phonecheck.value,
    datatype:"text",
    success:function(data) 
    { 
      alert(data);
     if(data=="yes"){
      
     
     }else if(data=="no"){
     
      thisc=false;
     }else{
      thisc=false; 
     }
    } 
  }); 

  }
  if(!thisc){
    return (false);
  }



}
function doregSubmit(RegForm)
{


    
    document.RegForm.submit();
  
}
</script> 


<script type="text/javascript"> 
 

function sendSMS() //点击提交留言ajax显示
{ 
  
	var mobile=$("#mobile").val();
	
  var me= /^1[3|4|5|8][0-9]\d{4,8}$/  ;
  if (!me.test(mobile))
  {
   $("#shoujihaoma").html("请正确输入手机号码!");
   $("#shoujihaoma").css("color","red");
    return (false);
  }else{

 $("#shoujihaoma").html("用于接收验证码及订单信息!");
   $("#shoujihaoma").css("color","#999999");

	$.ajax({ 
		type:'post', //传送的方式,get/post 
		url:'post_mt.php', //发送数据的地址 
		cache:'false', 
		data:'name='+mobile, 

		success:function(data) 
		{ 
     	
		}
	}) 
}
  time(document.getElementById("reSend"));
} 

</script>


</head>

<body>

<div id="loginbox" style="display:none">
<form name="LoginForm" method="post" id="alllogin" action="login.php" onSubmit="return InputCheck(this)">
  <div class="login_title">会员登录</div>
  <div class="login_input">
    <div class="input"><span>账号：</span><span><input name="username" type="text" /></span></div>
    <div class="input"><span>密码：</span><span><input name="password" type="password" /></span></div>
    <input name="headeraction" type="hidden" value="index" />
    <div class="login_input_1 clearfix"><input name="" type="checkbox" value="" id="store1" /><label for="store1">自动登录</label><a onclick="forgetPass()" href="javascript:void(0)">找回密码</a><span style="color:red;display:none" id="passerrorShow" >&nbsp;&nbsp;账号或密码错误</span></div>
    <div class="reg clearfix"><span><input class="login_btn" name="submit" type="image" src="images/login.jpg" /></span><span>还没有账号？</span><a href="reg11.php">立即注册</a></div>
  </div>
</form>
</div>

 
<div id="loginbox1" style="display:none">
<form name="LoginForm" method="post" id="alllogin" action="login-shop.php" onSubmit="return InputCheck(this)">
  <div class="login_title">店铺登录</div>
  <div class="login_input">
    <div class="input"><span>账号：</span><span><input name="username" type="text" /></span></div>
    <div class="input"><span>密码：</span><span><input name="password" type="password" /></span></div>
    <div class="reg clearfix"><span><input class="login_btn" name="submit" type="image" src="images/login.jpg" /></span><span style="color:red;display:none" id="passerrorShow1" >&nbsp;&nbsp;账号或密码错误</span></div>
  </div>
</form>
</div>
<div id="loginbox3" style="display:none">
  <div class="login_title">忘记密码</div>
  <div class="login_input">
    <div class="inputb"><span>账号：</span><span><input  name="username" id="userzhanghao" type="text" /></span></div>
    <div class="inputc"><span></span><span><input style="width:98px;height:22px;color: #336666;font-size: 12px;line-height: 32px;" id="reSend1" value="发送验证码" onclick="sendSMS()" name="password" type="text" /></span></div>
     <div class="inputa"><span>验证码：</span><span><input style="width:98px;" id="yanzhengma" name="password" type="password" /></span></div>
    <div class="reg clearfix"><span><input class="" onclick="phoneCheck()" type="image" src="images/login.jpg" /></span></div>
  </div>

</div>


<div class="top">
  <div class="top_content clearfix"><span class="left"><a href="index.php"><img src="images/wmwlogo.png"></a></span><span class="right">
 
  <?php
    if(isset($_SESSION['username'])){
      echo $_SESSION['username'],'欢迎你！';
      echo '<a href="login.php?action=logout">登出</a>';
    }else{
      echo ' <a href="#" id="login">';
      echo '登录';
      echo '</a> / <a href="reg11.php">注册</a>';
    }
  ?>
  | <a href="#" id="shoplogin">店铺登录</a></span></div>
</div>

<div class="content_logo"><a href="index.php"><img src="images/logo.png"></a></div>
<div class="content clearfix">
  <div class="content_con clearfix">
    <div class="box" style="height:530px;">
    <form name="RegForm" method="post" action="reg.php" onsubmit="return RegCheck(this)" >
      <div class="box_title"><div class="box_title_title">会员注册</div></div>
      <div class="box_content">
        <div class="input_list clearfix" style="margin-top:30px;">
          <div class="tit2">账号：</div>
          <div class="left"><input name="username" type="text" onblur="usernamecheck()" id="reguser"></div> 
          <span class="text_note left" id="zhanghao">3-15个字符，一个汉字为两个字符</span>
        </div>
        <div class="input_list clearfix">
          <div class="tit2">密码：</div>
          <div class="left"><input name="password1" type="password"  onblur="userphonecheck()" id="regphone" ></div>
          <span class="text_note left" id="mima">最少6个字符</span>
        </div>
        <div class="input_list clearfix">
          <div class="tit2">确认密码：</div>
          <div class="left"><input name="password2" type="password"></div>
          <span class="text_note left" id="mima2" >与上方填写相同</span>
        </div>
        <div class="input_list clearfix">
          <div class="tit2">手机号码：</div>
          <div class="left">
            <input name="mobile" id="mobile" type="text" onblur="mobilecheck()" id="mobileid" >
            <div class="code"><input  name=""  id="reSend" disabled="false" style="width:90px;height:26px;" onclick="sendSMS()" type="button" class="resend-a" value="发送验证码"/>    <!--  <a  onclick="sendSMS();" class="clearfix">发送验证码</a> --></div>
          </div>
          <span class="text_note left" id="shoujihaoma">用于接收验证码及订单信息</span>
        </div>
        <div class="input_list clearfix">
          <div class="tit2">短信验证码：</div>
          <div class="left"><input type="text" name="phonecheck" class="codeinput"></div>
          <span class="text_note left" id="yanzhengma">填写手机接收到的验证码</span>
        </div>
        <div class="reg_btn clearfix">
          <span class="left"><input type="image"  src="images/reg.jpg"></span>
          <span class="reg">已经有账号？ <a href="#" id="nowlogin" >立即登录</a></span>
        </div>
        <div class="deal">
        <input name="" type="checkbox" id="store2" value="" checked="checked">
        <label for="store2">我同意 《<a href="#">使用条款和协议</a>》</label>
        </div>
      </div>
      </form>
    </div>  
  </div>
</div>

<?php include('bottom.php') ?>
</body>
</html>
